import Cookies from 'js-cookie';


export function validatorPassword(rule, value, callback) {
  value || (value = '');
  if (value.length < 20 && !Cookies.get('yourPassword')) {
    const patt = /(?=.*\d)(?=.*[a-zA-Z])^.{6,20}$/;
    if (patt.test(value) && value && !Cookies.get('yourPassword')) {
      callback();
    } else {
      callback(new Error('密码需要在6-20位之间并包含字母和数字'));
    }
  }
  callback();
}
